make assignment work on ustrip'ed StridedArrays#645
make assignment work on ustrip'ed StridedArrays#645bjarthur wants to merge 1 commit intoJuliaPhysics:masterfrom
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #645 +/- ##
=======================================
Coverage 89.07% 89.07%
=======================================
Files 16 16
Lines 1492 1492
=======================================
Hits 1329 1329
Misses 163 163
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
This will also apply to ranges, which makes it different from the current behavior: Before: julia> r = (1:5)u"m"
(1:5) m
julia> ustrip(r)
1:1:5After: julia> r = (1:5)u"m"
(1:5) m
julia> ustrip(r)
5-element reinterpret(Int64, ::StepRange{Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}, Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}):
1
2
3
4
5We could add a method Reinterpreting is useful in two ways: to enable mutation of the original array, and to avoid allocations. For ranges and We could implement |
|
how about redefining |
I like that. Maybe we could even use |
|
i tried StridedArrays and it works for my use case. have rebased the change into this PR. tests pass locally. |
|
anything else i need to do here? the CI is "awaiting approval". |
|
I just noticed that this is technically a breaking change. At least I consider it as one. A user that calls This could be avoided if we implement this as |
|
perhaps it's time to bump the version to 2.0? what other new features are being held up because it would be a breaking change that we could implement if we did so? certainly i'd like to see that deprecated method removed in v2.0. that should've been done in v0.5. |
|
I would like to release v2.0, but there are more breaking changes that I think should be included (and some of them require some further discussion), so it will take some time. I still think we should use Functions like Is there a reason why you think we shouldn’t add |
|
should probably add the v2.0 label to this PR or the issue it fixes. i see there are two others with that label. i don't find it confusing that what is confusing is that that we disagree is an indication that more opinions should be solicited. who could we ping that is a heavy user of Unitful.jl? |
fixes #644
note that i'm only superficially familiar with Unitful.jl, so am not sure if this breaks anything or is consistent with the roadmap. but the tests pass locally.